/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Graph;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Olivier
 */

public class Instructions {
	public Instructions () {
		atomic = false;
		label = "";
		variables = new ArrayList<Variables>();
		position = "";
		next = new ArrayList<Instructions>();
	}
	
	public Instructions (boolean a, String l, List<Variables> v, String p, List<Instructions> n) {
		atomic = a;
		label = l;
		variables = v;
		position = p;
		next = n;
	}
	
	public boolean isAtomic () {
		return atomic;
	}
	
	public String getLabel () {
		return label;
	}
	
	public List<Variables> getVariables () {
		return variables;
	}
	
	public Variables getVarFromId (int i) {
		return variables.get(i);
	}
	
	public String getPosition () {
		return position;
	}
	
	public List<Instructions> getNext () {
		return next;
	}
	
	public Instructions getNextFromID (int i) {
		return next.get(i);
	}
	
	public void setNext (Instructions n, int i) {
		next.set(i, n);
	}
	
	public void addNext (Instructions i) {
		next.add(i);
	}
	
	@Override
	public boolean equals (Object o) {
		boolean result;
		Instructions i = (Instructions)o;
		
		result = label.equals(i.getLabel());
		result = result && position.equals(i.getPosition());
		
		return result;
	}
	
	private boolean atomic;
	private String label;
	private List<Variables> variables;
	private String position;
	private List<Instructions> next;
}
